package com.igeekhome.wzgl.controller;

import com.igeekhome.wzgl.entity.MaterialInboundEntity;
import com.igeekhome.wzgl.entity.MaterialOutboundEntity;
import com.igeekhome.wzgl.service.IMaterialOutbound;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/mo")
@CrossOrigin
public class MaterialOutboundController {
    @Autowired
    private IMaterialOutbound iMaterialOutbound;
    @GetMapping("/page")
    public List<MaterialOutboundEntity> page(){return iMaterialOutbound.page();}
    @PostMapping("/insert")
    public int insert(@RequestBody MaterialOutboundEntity mo) {
        return iMaterialOutbound.insert(mo);
    }

    @GetMapping("/delete")
    public int delete(@RequestParam int id) {
        return iMaterialOutbound.delete(id);
    }

    @PostMapping("/update")
    public int update(@RequestBody MaterialOutboundEntity mo) {
        return iMaterialOutbound.update(mo);
    }

    @GetMapping("/select")
    public List<MaterialOutboundEntity> select(@RequestParam int id) {
        return iMaterialOutbound.select(id);
    }
    @GetMapping("/getById")
    public MaterialOutboundEntity getById(@RequestParam int id){
        return iMaterialOutbound.getById(id);
    }
}